<?php
require_once("Unit.class.php");
require_once("db.php");

class Army extends Unit{

	function __construct($nation, $color, $unitId){
		global $db_connect;
		echo "New army object created named <b>$unitId</b> with color <b>$color</b> and belongs to <b>$nation</b><br/>"; //test-code
		parent::setNation($nation);
		parent::setColor($color);
		parent::setUnitId($unitId);

		$qry = "INSERT INTO army(nation, color, unitid) VALUES(?,?,?)";
		$stmt = $db_connect -> prepare($qry);
		$stmt -> bind_param('sss',$nation,$color,$unitId);
		$stmt -> execute();
	}
}

?>
